package com.basic;

import com.business.socialcredit.SocialCreditFactory;
import com.frame.struts.BaseBean;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.utils.CommUtil;
import com.utils.ConnectionManager;

import javax.servlet.http.HttpServletResponse;
import com.frame.struts.ActionContext;

public class ZsForm extends BaseBean 
{
	private static final long serialVersionUID = 1L;
	
	private String qyid			="";
	
	
	private String zyzscqlx ;
	private String mc ;
	private String zcsj ;
	private String zcdz ;
	private String yxq ;
	private String qqxwjl ;
    
    private int  xh			=0;
    private String optrid			="";	
    private Date 	optdate	=new Date();
    private String remark="";
    private String 	recstate	="";
    
    
  
    
    
    public ZsForm() 
	{
    }
	
	public String addZs() {
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		this.setQyid(qyid);
		this.setOptdate(new Date());
		this.setOptrid(CommUtil.getUserId(request));
		this.setXh(SocialCreditFactory.getNextXh("qy_zscq", qyid));
		
		if (factory.addZs(this)) 
		{
			   // response.sendRedirect("/kehuzk/queryPsEquip.jsp");
				return "success";
		}else
		{
			return "failed";
		}
		
	}

	public String modifyZs() {
		HttpServletRequest request = ActionContext.getActionContext().getRequest();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		
		Deletion d=new Deletion("qy_zscq",new String[]{"qyid","xh"},new Object[]{qyid,this.xh});
		factory.delete(d);
		
		this.setQyid(qyid);
		this.setOptdate(new Date());
		this.setOptrid(CommUtil.getUserId(request));
		this.setXh(SocialCreditFactory.getNextXh("qy_zscq", qyid));
		
		if (factory.addZs(this))
		{
			    //response.sendRedirect("/basic/queryPsEquip.jsp");
				return "success";
		}else
		{
			//response.sendRedirect("/basic/failed.jsp");
			return "failed";
		}
	}

	public String getZyzscqlx() {
		return zyzscqlx;
	}

	public void setZyzscqlx(String zyzscqlx) {
		this.zyzscqlx = zyzscqlx;
	}

	public String getMc() {
		return mc;
	}

	public void setMc(String mc) {
		this.mc = mc;
	}

	public String getZcsj() {
		return zcsj;
	}

	public void setZcsj(String zcsj) {
		this.zcsj = zcsj;
	}

	public String getZcdz() {
		return zcdz;
	}

	public void setZcdz(String zcdz) {
		this.zcdz = zcdz;
	}

	public String getQqxwjl() {
		return qqxwjl;
	}

	public void setQqxwjl(String qqxwjl) {
		this.qqxwjl = qqxwjl;
	}

	public String getQyid() {
		return qyid;
	}

	public void setQyid(String qyid) {
		this.qyid = qyid;
	}


	


	public String getYxq() {
		return yxq;
	}

	public void setYxq(String yxq) {
		this.yxq = yxq;
	}

	

	public int getXh() {
		return xh;
	}

	public void setXh(int xh) {
		this.xh = xh;
	}

	public String getOptrid() {
		return optrid;
	}

	public void setOptrid(String optrid) {
		this.optrid = optrid;
	}

	public Date getOptdate() {
		return optdate;
	}

	public void setOptdate(Date optdate) {
		this.optdate = optdate;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getRecstate() {
		return recstate;
	}

	public void setRecstate(String recstate) {
		this.recstate = recstate;
	}
	
	
  
	          
}
